﻿@using System.Data
@model DataTable
@{
    ViewBag.Title = TempData["Title"];
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <style type="text/css">

        body {
            background-color: white;
        }

        table {
            border-collapse: collapse;
            width: 100%;
        }

            table td, th {
                padding: 5px;
            }

            table td {
                text-align: center;
            }

        .tools {
            border: 1px solid #cccccc;
            width: 100%;
            height: 30px;
            line-height: 28px;
        }

            .tools a {
                width: 100px;
                text-align: center;
                border: 0px solid;
                height: 30px;
                margin-left: 20px;
            }
    </style>
</head>
<body>
    <div>
        <div class="tools">
            <a href="javascript:void(0)" name="print" onclick="print()">打印</a>
        </div>
        <br />
        <table border="1">
            <thead>
                <tr>
                    @for (int column = 0; column < Model.Columns.Count; column++)
                    {
                        <th>@Model.Columns[column].Caption</th>
                    }
                </tr>
            </thead>
            <tbody>
                @for (int row = 0; row < Model.Rows.Count; row++)
                {
                    <tr>
                        @for (int column = 0; column < Model.Columns.Count; column++)
                        {
                            <td>@Model.Rows[row][column]</td>
                        }
                    </tr>
                }
            </tbody>
        </table>
    </div>
</body>
</html>
<script src="~/Content/Jquery/jQuery-2.2.0.min.js"></script>
<script src="~/Admin/libs/jQuery.print-master/jQuery.print.js"></script>
<script type="text/javascript">
    function print() {
        $("table").print();
    }
</script>